home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PROGEDIT / 0748.ZIP / C < prev    next >
Text File  |  1986-12-29  |  763b  |  48 lines

  1. /* These macros are for C programmers - inserts a "for" template */
  2. /* and an "if" template */
  3.  
  4. init()
  5. {
  6.   assign_key("formac", 6);    /* <CTRL> F */
  7.   assign_key("ifmac",  5);    /* <CTRL> E */
  8. }
  9.  
  10. formac()
  11. {
  12.   int col;
  13.   int i;
  14.  
  15.   col = currcol();
  16.   insert("for ( ; ; )\n");
  17.   setcol(col);
  18.   insert("{\n");
  19.   setcol(col);
  20.   insert("}");
  21.   up();  up();
  22.   for (i = 1;  i <= 4;  i += 1)
  23.     right();
  24. }
  25.  
  26. ifmac()
  27. {
  28.   int col;
  29.   int i;
  30.  
  31.   col = currcol();
  32.   insert("if ()\n");
  33.   setcol(col);
  34.   insert("{\n");
  35.   setcol(col);
  36.   insert("}\n");
  37.   setcol(col);
  38.   insert("else\n");
  39.   setcol(col);
  40.   insert("{\n");
  41.   setcol(col);
  42.   insert("}");
  43.   for (i = 1;  i <= 5;  i++)
  44.     up();
  45.   for (i = 1;  i <= 3;  i++)
  46.     right();
  47. }
  48.